<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>增加商品</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="../../../elementUI/index.css">
  <link rel="stylesheet" href="../../../css/index.css">
</head>

<body>
  <div id="app" class="minWidth">
    <el-form :model="form" :rules="rules" ref="contract" inline-message="true" style="width: 100%">
      <div class="table_titel">
        <div class="titel">增加商品</div>
      </div>
      <el-descriptions :column="3" border size="small">
        <el-descriptions-item label="商品名称">
          <el-form-item prop="Article_Name">
            <el-input v-model.trim="form.Article_Name" placeholder="请输入商品名称"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="品牌">
          <el-form-item prop="Brand_SerialNumber">
            <el-select v-model.trim="form.Brand_SerialNumber" placeholder="请选择商品品牌" filterable style="width: 100%">
              <el-option v-for="(item,index) in brand" :key="index" :label="item.Brand_Name"
                :value="item.Brand_SerialNumber"></el-option>
            </el-select>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="商品类别">
          <el-form-item prop="Category_SerialNumber">
            <el-select v-model.trim="form.Category_SerialNumber" placeholder="请选择商品类别" filterable style="width: 100%">
              <el-option v-for="(item,index) in category" :key="index" :label="item.Category_Name"
                :value="item.Category_SerialNumber"></el-option>
            </el-select>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="商品系列">
          <el-form-item prop="Series_SerialNumber">
            <el-select v-model.trim="form.Series_SerialNumber" placeholder="请选择商品系列" filterable style="width: 100%">
              <el-option v-for="(item,index) in series" :key="index" :label="item.Series_Name"
                :value="item.Series_SerialNumber"></el-option>
            </el-select>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="商品款型">
          <el-form-item prop="Item_SerialNumber">
            <el-select v-model.trim="form.Item_SerialNumber" placeholder="请选择商品款型" filterable style="width: 100%">
              <el-option v-for="(item,index) in item" :key="index" :label="item.Item_Name"
                :value="item.Item_SerialNumber"></el-option>
            </el-select>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="吊牌价">
          <el-form-item prop="Unit_Price">
            <el-input v-model.trim="form.Unit_Price" placeholder="请输入吊牌价"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="SKU尺寸">
          <el-form-item prop="Size">
            <el-input v-model.trim="form.Size" placeholder="请输入SKU尺寸"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="SKU重量">
          <el-form-item prop="Weight">
            <el-input v-model.trim="form.Weight" placeholder="请输入SKU重量"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="SKU单位">
          <el-form-item prop="Weight_Unit">
            <el-select v-model.trim="form.Weight_Unit" placeholder="请选择SKU单位" filterable style="width: 100%">
              <el-option v-for="(item,index) in unit" :key="index" :label="item.Unit"
                :value="item.Article_Unit_SerialNumber"></el-option>
            </el-select>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="小包装数量">
          <el-form-item prop="Package_Quantity">
            <el-input v-model.trim="form.Package_Quantity" placeholder="请输入小包装数量"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="SKU包装尺寸">
          <el-form-item prop="SKU_Package_Size">
            <el-input v-model.trim="form.SKU_Package_Size" placeholder="请输入SKU包装尺寸"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="大包装数量">
          <el-form-item prop="Carton_Quantity">
            <el-input v-model.trim="form.Carton_Quantity" placeholder="请输入大包装数量"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="商品封面">
          <el-form-item prop="pic">
            <div class="preview" v-show="form.pic">
              <el-image class="el-upload-list__item-thumbnail" style="width: 148px; height: 148px" :src="form.pic"
                fit="contain"></el-image>
              <span class="el-upload-list__item-actions">
                <span @click="handlePictureCardPreview(form.pic)"><i class="el-icon-zoom-in"></i></span>
                <span @click="handleRemove('front')"><i class="el-icon-delete"></i></span>
              </span>
            </div>
            <el-upload v-show="!form.pic" class="upload-demo" :show-file-list="false" list-type="picture-card" action=""
              accept="image/*" :before-upload="uploadFront">
              <i slot="default" class="el-icon-plus"></i>
              <div class="el-upload__tip" slot="tip">上传正方形图片，且大小不超过120k</div>
            </el-upload>
          </el-form-item>
        </el-descriptions-item>
      </el-descriptions>
      <div class="table_titel">
        <div class="titel">商品规格</div>
        <div class="operation">
          <el-button type="primary" size="small" @click="add_article_specifications">新增</el-button>
          <el-button type="danger" size="small" @click="remove_article_specifications">删除</el-button>
        </div>
      </div>
      <el-descriptions :column="3" :rules="rules" border size="small"
        v-for="(item,index) in form.Children.article_specifications" :key="index">
        <el-descriptions-item label="SKU数量">
          <el-form-item :rules="Packing" :prop="'Children.article_specifications.'+index+'.Packing'">
            <el-input v-model.trim="item.Packing" placeholder="请输入SKU数量"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="装箱尺寸">
          <el-form-item prop="PackingSize">
            <el-input v-model.trim="item.PackingSize" placeholder="请输入装箱尺寸"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="外箱尺寸">
          <el-form-item prop="OutsidePackingSize">
            <el-input v-model.trim="item.OutsidePackingSize" placeholder="请输入外箱尺寸"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="零售价">
          <el-form-item :rules="Unit_Price" :prop="'Children.article_specifications.'+index+'.Unit_Price'">
            <el-input v-model.trim="item.Unit_Price" placeholder="请输入零售价"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="规格说明">
          <el-form-item :rules="Specifications_Name"
            :prop="'Children.article_specifications.'+index+'.Specifications_Name'">
            <el-input v-model.trim="item.Specifications_Name" placeholder="请输入规格说明"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="净含量">
          <el-form-item prop="Net_Content">
            <el-input v-model.trim="item.Net_Content" placeholder="请输入净含量"></el-input>
          </el-form-item>
        </el-descriptions-item>
        <el-descriptions-item label="商品规格封面">
          <el-form-item>
            <div class="preview" v-show="item.Picture_URL">
              <el-image class="el-upload-list__item-thumbnail" style="width: 148px; height: 148px" :src="item.pic"
                fit="contain"></el-image>
              <span class="el-upload-list__item-actions">
                <span @click="handlePictureCardPreview(item.pic)"><i class="el-icon-zoom-in"></i></span>
                <span @click="handleRemove('Specifications', item.pic)"><i class="el-icon-delete"></i></span>
              </span>
            </div>
            <div @click="handleSpecification(index)">
              <el-upload v-show="!item.Picture_URL" class="upload-demo" :show-file-list="false" list-type="picture-card"
                action="" accept="image/*" :before-upload="Specifications">
                <i slot="default" class="el-icon-plus"></i>
                <div class="el-upload__tip" slot="tip">上传正方形图片，且大小不超过120k</div>
              </el-upload>
            </div>
          </el-form-item>
        </el-descriptions-item>
      </el-descriptions>
      <div class="table_titel">
        <div class="titel">条码上传</div>
      </div>
      <el-form-item prop="pic">
        <div class="preview" v-show="item.pic" v-for="(item, index) in fileList2" :key="index">
          <el-image class="el-upload-list__item-thumbnail" style="width: 148px; height: 148px" :src="item.pic"
            fit="contain"></el-image>
          <span class="el-upload-list__item-actions">
            <span @click="handlePictureCardPreview(item.pic)"><i class="el-icon-zoom-in"></i></span>
            <span @click="handleRemove('barcode',item.Picture_Order)"><i class="el-icon-delete"></i></span>
          </span>
        </div>
        <el-upload v-show="fileList2.length < 2" class="upload-demo" :show-file-list="false" list-type="picture-card"
          action="" accept="image/*" :before-upload="uploadBarcode">
          <i slot="default" class="el-icon-plus"></i>
          <div class="el-upload__tip" slot="tip">上传正方形图片，且大小不超过100kb</div>
        </el-upload>
      </el-form-item>
      <div class="table_titel">
        <div class="titel">商品主图上传</div>
      </div>
      <el-form-item prop="pic">
        <div class="preview" v-show="item.pic" v-for="(item, index) in fileList" :key="index">
          <el-image class="el-upload-list__item-thumbnail" style="width: 148px; height: 148px" :src="item.pic"
            fit="contain"></el-image>
          <span class="el-upload-list__item-actions">
            <span @click="handlePictureCardPreview(item.pic)"><i class="el-icon-zoom-in"></i></span>
            <span @click="handleRemove('banner',item.Picture_Order)"><i class="el-icon-delete"> </i></span>
          </span>
        </div>
        <el-upload v-show="fileList.length < 15" class="upload-demo" :show-file-list="false" list-type="picture-card"
          action="" accept="image/*" :before-upload="uploadBanner">
          <i slot="default" class="el-icon-plus"></i>
          <div class="el-upload__tip" slot="tip">上传正方形图片，且大小不超过100kb</div>
        </el-upload>
      </el-form-item>
      <div class="table_titel">
        <div class="titel">商品详情页图片上传</div>
      </div>
      <el-form-item prop="pic">
        <div class="preview" v-show="item.pic" v-for="(item, index) in fileList1" :key="index">
          <el-image class="el-upload-list__item-thumbnail" style="width: 148px; height: 148px" :src="item.pic"
            fit="contain"></el-image>
          <span class="el-upload-list__item-actions">
            <span @click="handlePictureCardPreview(item.pic)"><i class="el-icon-zoom-in"></i></span>
            <span @click="handleRemove('details',item.Picture_Order)"><i class="el-icon-delete"></i></span>
          </span>
        </div>
        <el-upload v-show="fileList1.length < 15" class="upload-demo" :show-file-list="false" list-type="picture-card"
          action="" accept="image/*" :before-upload="uploadDetails">
          <i slot="default" class="el-icon-plus"></i>
          <div class="el-upload__tip" slot="tip">上传正方形图片，且大小不超过100kb</div>
        </el-upload>
      </el-form-item>
      <el-form-item class="form-operation">
        <el-button @click="window.history.back()">返回</el-button>
        <el-button type="success" @click="onExcel">导入</el-button>
        <el-button type="primary" :loading="loading" @click="submitForm('contract')">提交</el-button>
      </el-form-item>
    </el-form>
    <el-dialog :visible.sync="dialogVisible">
      <img width="100%" :src="dialogImageUrl" alt="">
    </el-dialog>
    <el-dialog :visible.sync="dialogVisible1">
      <div class="table_titel">
        <div class="titel">导入表格</div>
      </div>
      <el-upload id="Excel" class="upload-demo" action="" :before-remove="beforeRemove" :file-list="fileList"
        :before-upload="uploadDetails1">
        <el-button size="small" type="primary" v-show="fileList3.length<1">导入</el-button>
        <div slot="tip" class="el-upload__tip" v-show="fileList3.length<1">请上传xlsx表格</div>
      </el-upload>
      <el-button size="small" type="primary" :loading="loading" @click="submitForm1">点击上传</el-button>
    </el-dialog>
  </div>
  <script type="text/javascript" src="../../../js/jquery-3.6.0.min.js"></script>
  <script type="text/javascript" src="../../../js/jquery.cookie.js"></script>
  <script type="text/javascript" src="../../../js/vue.min.js"></script>
  <script type="text/javascript" src="../../../elementUI/index.js"></script>
  <script type="text/javascript" src="../../../js/utils.js"></script>
  <script type="text/javascript" src="../../../js/ID_Validity.js"></script>
  <script type="text/javascript" src="../../../js/compressor.js"></script>
  <script type="text/javascript" src="../../../js/FileSaver.min.js"></script>
  <script type="text/javascript" src="../../../js/FileSaver.js"></script>
  <script type="text/javascript" src="../../../js/xlsx.full.min.js"></script>
  <script type="text/javascript" src="./js/Add.js"></script>
</body>

</html>